using System.Collections.Generic;
using Common;
using ImageProcessing.Common;

namespace ImageProcessing.Storage
{
    public interface IPersistanceDB
    {
        List<InterestPoint> LoadAllPoints();
        void SavePoints(TagInfo tagInfo, List<InterestPoint> interestPoints);
        void Clear();
    }

    public static class PersistanceHelpers
    {
        public static List<InterestPoint> BuildInterestPoints(IEnumerable<PointInfo> pointInfos)
        {
            List<InterestPoint> result = new List<InterestPoint>();
            if (pointInfos != null)
                foreach (var ipd in pointInfos)
                {
                    InterestPoint ip = new InterestPoint(ipd);
                    result.Add(ip);
                }

            return result;
        }

        public static List<PointInfo> BuildPointInfos(IEnumerable<InterestPoint> interestPoints)
        {
            List<PointInfo> result = new List<PointInfo>();

            if (interestPoints != null)
                foreach (var interestPoint in interestPoints)
                {
                    result.Add(interestPoint.PointInfo);
                }

            return result;
        }
    }
}